package com.chen.blue.controller.admin.business;


import com.chen.blue.annotation.permission.DataPermission;
import com.chen.blue.domain.query.business.ContestApplyRecordQuery;
import com.chen.blue.domain.vo.business.ContestApplyRecordVo;
import com.chen.blue.exception.e.DtoNullException;
import com.chen.blue.result.DataResult;
import com.chen.blue.result.R;
import com.chen.blue.service.business.IContestApplyRecordService;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 竞赛申请活动记录表 前端控制器
 * </p>
 *
 * @author CLT
 * @since 2024-05-23
 */
@ApiSort(994)
@Api(tags = "申报管理-赛事申请记录模块")
@Validated
@RestController
@RequestMapping("/contest/record")
public class ContestApplyRecordController {

    @Resource
    private IContestApplyRecordService iContestApplyRecordService;

    @DataPermission
    @ApiOperation(value = "多条件查询竞赛申请记录", notes = "多条件查询竞赛申请记录")
    @PostMapping("/query")
    public R<DataResult<List<ContestApplyRecordVo>>> query(@RequestBody ContestApplyRecordQuery contestApplyRecordQuery) throws DtoNullException {

        return R.success(iContestApplyRecordService.queryContestApplyRecord(contestApplyRecordQuery));

    }

    @ApiOperation(value = "ID查询竞赛申请记录", notes = "ID查询竞赛申请记录")
    @GetMapping("/queryById/{relation}")
    public R<DataResult<List<ContestApplyRecordVo>>> queryById(@PathVariable("relation") String relation, Integer stageCurrent) throws DtoNullException {

        return R.success(iContestApplyRecordService.queryContestApplyRecordById(relation, stageCurrent));

    }

}

